<!--授予角色权限-->
<template>
  <div class="wrapper-container">
    <div class="search-container">
      <div class="search-container-left">
        <div class="search-container-item" style="display:flex; ">
          <span>学期：</span>
          <el-select
            v-model="trem"
            style="width: 90px"
            size="mini"
            placeholder="请选择"
          >
            <el-option
              v-for="item in xqList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
            <!-- query: { id: 1, itemTypes: itemTypeLoop.toString() }, -->
          </el-select>
          <div style="margin-left:30px;margin-top:3px">
            <ButtonItem
              @click="
                $router.push({
                  path: '/teacher/SupervisionTeam/permissionsor'
                })
              "
              :name="'授予角色权限'"
              :link="''"
              :icon="''"
              :buttonColor="'green'"
            ></ButtonItem>
          </div>
        </div>
      </div>
    </div>
    <div class="table-container">
      <el-table
        max-height="600"
        :data="tableData"
        border
        style="width: 100%"
        class="table-data"
        row-class-name="row-class"
        cell-class-name="cell-class"
        header-row-class-name="header-row-class"
        header-cell-class-name="header-cell-class"
      >
        <el-table-column prop="sqsjlx" label="授权数据类型" align="center">
        </el-table-column>
        <el-table-column prop="sqsjfwz" label="授权数据范围" align="center">
        </el-table-column>

        <el-table-column prop="bsyjs" label="被授予角色" align="center">
        </el-table-column>

        <el-table-column prop="bsqr" label="被授予人" align="center">
        </el-table-column>

        <el-table-column label="操作" align="center">
          <template slot-scope="scope">
          <ButtonItem
            style="margin: 0 auto"
            @click="guanbi(scope.$index)"
            :name="'关闭'"
            :link="''"
            :icon="''"
            :buttonColor="'red'"
          ></ButtonItem>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <div
      class="search-container"
      style="display: flex; justify-content: center !important"
    >
      <ButtonItem
        :name="'返回'"
        :link="''"
        :icon="''"
        @click="backPer"
        :buttonColor="'yellow'"
      ></ButtonItem>
    </div>
  </div>
</template>

<script>
import { getlist,guan } from "@/api/teacher/admin";
import SelectItem from "../../../components/SelectItem.vue";
import InputItem from "../../../components/InputItem.vue";
import ButtonItem from "../../../components/ButtonItem.vue";
export default {
  components: {
    SelectItem,
    InputItem,
    ButtonItem
  },
  data() {
    return {
      xq: "2020春",
      xqList: [
        {
          value: "2020春",
          label: "2020春"
        },
        {
          value: "2020夏",
          label: "2020夏"
        }
      ],
      systemList: [
        {
          value: "系1",
          label: "系1"
        },
        {
          value: "系2",
          label: "系2"
        },
        {
          value: "系3",
          label: "系3"
        }
      ],
      roleList: [
        {
          value: "教研室主任",
          label: "教研室主任"
        },
        {
          value: "队长",
          label: "队长"
        },
        {
          value: "大队长",
          label: "大队长"
        },
        {
          value: "系领导",
          label: "系领导"
        },
        {
          value: "教科处领导",
          label: "教科处领导"
        },
        {
          value: "管理员",
          label: "管理员"
        },
        {
          value: "无",
          label: "无"
        }
      ],
      teacherName: "",
      peopleList: [],
      peopleText: "被授予人",
      tableData: [
        {
          permission: "专业课",
          system: "系1",
          role: "队长",
          people: "李教员"
        },
        {
          permission: "专业课",
          system: "系1",
          role: "队长",
          people: "李教员"
        },
        {
          permission: "专业课",
          system: "系1",
          role: "队长",
          people: "李教员"
        },
        {
          permission: "教员平均得分",
          system: "系1",
          role: "队长",
          people: "李教员"
        },
        {
          permission: "教员平均得分",
          system: "系1",
          role: "队长",
          people: "李教员"
        },
        {
          permission: "教员平均得分",
          system: "系1",
          role: "队长",
          people: "李教员"
        },
        {
          permission: "教员平均得分",
          system: "系1",
          role: "队长",
          people: "李教员"
        },
        {
          permission: "教员平均得分",
          system: "系1",
          role: "队长",
          people: "李教员"
        }
      ]
    };
  },
  created() {
    this.getlist();
  },
  methods: {
    getlist() {
      let obj = {
        trem: this.trem
      };
      return new Promise(resolve => {
        getlist(obj).then(res => {
          this.tableData = res.data.data;
          console.log(res.data.data, "aaaaaaaaaaaaaaaaaaaaa");
        });
      });
    },
    guanbi(index){
      let ids=this.tableData[index].id
       return new Promise(resolve => {
        guan(ids).then(res => {
          this.getlist()
        });
      });
    },
    givPer() {},
    backPer() {}
  },
  mounted() {}
};
</script>
<style lang="less" scoped>
.search-container {
  justify-content: flex-start !important;
}

.search-button {
  cursor: pointer;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 27px;
  background: #f1f8fe;
  border: 1px solid #51aef6;
  border-radius: 6px;

  > span {
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #51aef6;
  }

  > img {
    width: 19px;
    height: 19px;
    margin-right: 4px;
  }
}

.table-container {
  margin-top: 30px;

  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

  .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }

  .wrapper-button {
    display: flex;
    flex-direction: column;
    align-items: center;

    > div {
      margin-bottom: 8px;
    }
  }
}
</style>

<style lang="less" scoped>
@import "../../../styles/special.less";
.table-container::v-deep .el-table__header th {
  border-color: #c7d7eb !important;
  padding-left: 10px;
}
.filter-button::v-deep .el-radio-button .el-radio-button__inner {
  border-radius: 6px !important;
  border: 1px solid #02c86c;
  color: #02c86c;
  background-color: #dfffef;
}
.filter-button::v-deep
  .el-radio-button__orig-radio:checked
  + .el-radio-button__inner {
  border: 1px solid #02c86c;
  color: white;
  background-color: #02c86c;
}
.wrapper-container {
  width: 1711px;
  margin: 0 auto;
}
.table-container {
  margin-top: 30px;

  .table-data {
    width: 100%;
    border: 0.8px solid #004ca7;
    border-radius: 9px;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #004ca7;
  }
}

.save-button {
  width: 87px;
  height: 36px;
  line-height: 36px;
  background: #fff6ef;
  border: 1px solid #f3b815;
  border-radius: 6px;
  font-size: 18px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #f3b815;
  text-align: center;
  margin: 82px auto;
}

.zuoyou {
  width: 200px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
</style>
